package health.lm.com.find.presenter;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.find.entity.EvaluationEntity;
import health.lm.com.find.fragment.EvaluationFragment;
import health.lm.com.find.model.ExperienceModel;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;

/**
 * @author GQI
 * @description: 商家评价
 * @date :2019-08-10 14:59
 */
public class EvaluationPresent extends XPresent<EvaluationFragment> {
    public void getListMore(boolean isRefresh, Object layout,String id ,int page, int pageSize) {
        ExperienceModel.getInstance().evaluation(id, page, pageSize, new SimpleCallBack<EvaluationEntity>() {
            @Override
            public void onSuccess(EvaluationEntity entity) {

                if (hasV()) {
                    getV().getDataSuccess(entity.getComment_list());
                }
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }

            @Override
            public void onError(ApiException e) {
                super.onError(e);
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }
        });

    }
}
